﻿using System;
using System.Web.UI;
using Google.Translates.Core;

namespace ml_test_google_trans.Translate
{
    public partial class MoreRequestTrans : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            DateTime startDate = DateTime.Now;
            for (int i = 0; i < Convert.ToInt32(txtRequestAmount.Text); i++)
            {
                string reVal = new TranslatorByGoogleHttp().GetTranslationsByLongSentence(txtSrc.Text, ddlFrom.SelectedValue,
                                                                                    ddlTo.SelectedValue);
                if (!string.IsNullOrEmpty(reVal))
                    reVal = "\r\n\r\nThe Request Number is [ " + (i + 1) + " ] : \r\n"+reVal;
                txtTrg.Text += reVal;
            }

            lblMsg.Text = "Uses Time : [" + (DateTime.Now - startDate).TotalMilliseconds + "]ms";
        }
    }
}